<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
    }
    .container{
      width: 100%;
      height: 300px;
      line-height: 300px;
      text-align: center;
      background: skyblue;
    }
    p{
      line-height: normal;
      display: inline-block;
      vertical-align: middle;
      width: 360px;
      background: lightblue;
      padding: 10px;
    }
  </style>
</head>
<body>
  <div class="container">
    <p>使用IFC布局，display:inline-block、text-align:center和vertical-align:middle方法来实现文本垂直居中 inline-block元素以单个封闭块来参与外部的IFC，其内部会生成一个BFC，不在本例讨论范围之内。</p>
  </div>
</body>
</html>